//
//  Loan_repaymentTableViewCell.m
//  JinFuThree
//
//  Created by 爱尚 on 2018/9/12.
//  Copyright © 2018年 毛韶谦. All rights reserved.
//

#import "Loan_repaymentTableViewCell.h"

@implementation Loan_repaymentTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initialize];
    }
    return self;
}

-(void)initialize{
    
    _periodsLabel = [[UILabel alloc]init];
    _periodsLabel.text = @"首期";
    _periodsLabel.textColor = ThemeMaoBlackColor;
    _periodsLabel.font = [UIFont boldSystemFontOfSize:15];
    _periodsLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:_periodsLabel];
    [_periodsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top).offset(28);
        make.left.mas_equalTo(self.mas_left).offset(12);
        make.width.mas_offset(@68);
        make.height.mas_offset(@16);
    }];
    
    _dateLabel = [[UILabel alloc]init];
    _dateLabel.text = @"18/09/11";
    _dateLabel.textColor = ThemeMaoBackgroundColor;
    _dateLabel.textAlignment = NSTextAlignmentRight;
    _dateLabel.font = [UIFont systemFontOfSize:10];
    [self addSubview:_dateLabel];
    [_dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(self.periodsLabel);
        make.top.mas_equalTo(self.periodsLabel.mas_bottom).offset(6);
        make.height.mas_offset(@11);
    }];
    
    _circleView = [[UIView alloc]init];
    _circleView.layer.masksToBounds = YES;
    _circleView.layer.cornerRadius = 4.5;
    _circleView.layer.borderColor = ThemeMaoColor.CGColor;
    _circleView.layer.borderWidth = 1.5;
    [self addSubview:_circleView];
    [_circleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.periodsLabel.mas_right).offset(17);
        make.top.mas_equalTo(self.periodsLabel.mas_bottom).offset(0);
        make.width.height.mas_offset(@9);
    }];
    
    _topline = [[UIView alloc]init];
    _topline.backgroundColor = ThemeMaoColor;
    [self addSubview:_topline];
    [_topline mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self);
        make.bottom.mas_equalTo(self.circleView.mas_top);
        make.width.mas_offset(@1.5);
        make.centerX.mas_equalTo(self.circleView);
    }];
    UIView *line = [[UIView alloc]init];
    line.backgroundColor = ThemeMaoColor;
    [self addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.circleView.mas_bottom);
        make.centerX.mas_equalTo(self.circleView);
        make.bottom.mas_equalTo(self.mas_bottom);
        make.width.mas_offset(@1.5);
    }];
    
    _moneyLabel = [[UILabel alloc]init];
    _moneyLabel.text = @"¥416.66";
    _moneyLabel.textColor = ThemeMaoBlackColor;
    _moneyLabel.font = [UIFont boldSystemFontOfSize:15];
    [self addSubview:_moneyLabel];
    [_moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(line.mas_right).offset(18);
        make.height.centerY.mas_equalTo(self.periodsLabel);
        make.right.mas_equalTo(self.mas_right).offset(-12);
        
    }];
    
    _moneyDetailLabel = [[UILabel alloc]init];
    _moneyDetailLabel.text = @"本金416.66+利息30.88";
    _moneyDetailLabel.font = [UIFont systemFontOfSize:12];;
    _moneyDetailLabel.textColor = ThemeMaoBackgroundColor;
    [self addSubview:_moneyDetailLabel];
    [_moneyDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.height.mas_equalTo(self.dateLabel);
        make.right.left.mas_equalTo(self.moneyLabel);
        
    }];
    
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
